package packge.io;

import java.io.*;

class IOTest5 {
	public static void main(String st[]) throws Exception {
		if (st.length != 1) {
			System.out.println("Enter file Name");
			System.exit(0);
		}
		String fileName = st[0];
		BufferedReader br = new BufferedReader(new FileReader(fileName));
		while (true) {
			String data = br.readLine();
			if (data == null)
				break;
			System.out.println(data);
		}
		System.out.println("\n\n --- Reading from keyboard ---");
		InputStreamReader isr = new InputStreamReader(System.in);
		br = new BufferedReader(isr);
		System.out.println("Enter Id");
		int id = Integer.parseInt(br.readLine());
		System.out.println("Enter name");
		String name = br.readLine();
		System.out.println("Enter email");
		String email = br.readLine();
		System.out.println("Enter phone");
		long phone = Long.parseLong(br.readLine());
		System.out.println("Enter fee");
		float fee = Float.parseFloat(br.readLine());
		String info = id + "\t" + name + "\t" + email + "\t" + phone + "\t" + fee;
		System.out.println(info);
		FileWriter wr = new FileWriter("ok.txt");
		wr.write(info);
		wr.close();
	}
}